package com.ykzhujiang.lovespirit.entity;

import java.util.Date;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import com.google.appengine.api.users.User;

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true")
public class Comment {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;

	@Persistent(defaultFetchGroup="true")
	private User author;

	@Persistent
	private String content;

	@Persistent
	private String sourceUrl;

	@Persistent
	private Date date;

	public Comment(User author, String content, Date date, String sourceUrl) {
		this.author = author;
		this.content = content;
		this.date = date;
		this.sourceUrl = sourceUrl;
	}

	public Long getId() {
		return id;
	}

	public User getAuthor() {
		return author;
	}

	public String getContent() {
		return content;
	}

	public String getSourceUrl() {
		return this.sourceUrl;
	}

	public Date getDate() {
		return date;
	}

	public void setAuthor(User author) {
		this.author = author;
	}

	public void setSourceUrl(String sourceUrl) {
		this.sourceUrl = sourceUrl;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public void setDate(Date date) {
		this.date = date;
	}
}